// Copyright (c) 2022 Presto Labs Pte. Ltd.
// Author: hyuan

#pragma once

#include <string>

#include <rapidjson/document.h>

#include "coin/proto/coin_query.pb.h"

namespace coin2::exchange::coincheck::order_v1 {

namespace error_code {

inline std::string GetExchangeOrderErrorMsg(
    const rapidjson::GenericValue<rapidjson::UTF8<>>& json) {
  if (json.HasMember("error")) {
    return json["error"].GetString();
  } else {
    return {};
  }
}

}  // namespace error_code

}  // namespace coin2::exchange::coincheck::order_v1
